import 'package:flutter/material.dart';
import 'pages/welcome_page.dart';
import 'pages/home_page.dart';
import 'pages/chat_page.dart';
import 'pages/identity_page.dart';
import 'pages/setting_page.dart';
import 'pages/upload_page.dart';
import 'AI/tina_dart/BaseAPI.dart';
import 'AI/dify_datasets.dart';
import 'AI/screen_shot_serve.dart';
import 'models/user_info.dart';
import 'serve/file_serve.dart';
import 'core/service_locator.dart';

/// 欢迎页面适配器
class WelcomePageAdapter extends StatelessWidget {
  final BaseAPI llm;
  final DifyKnowledgeDatabase difyKnowledge;
  final FileServe fileServe;

  const WelcomePageAdapter({
    Key? key,
    required this.llm,
    required this.difyKnowledge,
    required this.fileServe,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return WelcomePage(
      llm: llm,
      difyKnowledge: difyKnowledge,
      appDataDir: fileServe.appDataDir,
      fileServe: fileServe,
    );
  }
}

/// 主页适配器
class HomePageAdapter extends StatelessWidget {
  final BaseAPI llm;
  final DifyKnowledgeDatabase difyKnowledge;
  final UserInfo userInfo;
  final FileServe fileServe;

  const HomePageAdapter({
    Key? key,
    required this.llm,
    required this.difyKnowledge,
    required this.userInfo,
    required this.fileServe,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return HomePage(
      llm: llm,
      difyKnowledge: difyKnowledge,
      userInfo: userInfo,
      appDataDir: fileServe.appDataDir,
      fileServe: fileServe,
    );
  }
}

/// 聊天页面适配器
class ChatPageAdapter extends StatelessWidget {
  final BaseAPI llm;
  final DifyKnowledgeDatabase difyKnowledge;
  final UserInfo userInfo;
  final FileServe fileServe;

  const ChatPageAdapter({
    Key? key,
    required this.llm,
    required this.difyKnowledge,
    required this.userInfo,
    required this.fileServe,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ChatPage(
      llm: llm,
      difyKnowledge: difyKnowledge,
      userInfo: userInfo,
      appDataDir: fileServe.appDataDir,
      fileServe: fileServe,
    );
  }
}

/// 身份页面适配器
class IdentityPageAdapter extends StatelessWidget {
  final UserInfo userInfo;
  final Function(UserInfo) onUpdateUserInfo;
  final FileServe fileServe;

  const IdentityPageAdapter({
    Key? key,
    required this.userInfo,
    required this.onUpdateUserInfo,
    required this.fileServe,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return IdentityPage(
      appDataDir: fileServe.appDataDir,
      userInfo: userInfo,
      onUpdateUserInfo: onUpdateUserInfo,
      fileServe: fileServe,
    );
  }
}

/// 设置页面适配器
class SettingPageAdapter extends StatelessWidget {
  final BaseAPI llm;
  final DifyKnowledgeDatabase difyKnowledge;
  final FileServe fileServe;

  const SettingPageAdapter({
    Key? key,
    required this.llm,
    required this.difyKnowledge,
    required this.fileServe,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SettingPage(
      llm: llm,
      difyKnowledge: difyKnowledge,
      appDataDir: fileServe.appDataDir,
      fileServe: fileServe,
    );
  }
}

/// 上传页面适配器
class UploadPageAdapter extends StatelessWidget {
  final BaseAPI llm;
  final DifyKnowledgeDatabase difyKnowledge;
  final FileServe fileServe;
  final String appDataDir;
  final String? preSelectedImagePath;
  final ScreenShotServe? screenShotServe;

  const UploadPageAdapter({
    Key? key,
    required this.llm,
    required this.difyKnowledge,
    required this.fileServe,
    required this.appDataDir,
    this.preSelectedImagePath,
    this.screenShotServe,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return UploadPage(
      llm: llm,
      difyKnowledge: difyKnowledge,
      fileServe: fileServe,
      appDataDir: appDataDir,
      preSelectedImagePath: preSelectedImagePath,
      screenShotServe: screenShotServe,
    );
  }
} 